<script setup>
import HomePinal from "./HomePinal.vue";
import { getHotGoodsApi } from "@/api/home";
import { ref, onMounted } from "vue";

const newList = ref([]);

onMounted(async () => {
  const res = await getHotGoodsApi();
  // console.log(res.result);
  newList.value = res.result;
});
</script>

<template>
  <HomePinal title="人气推荐" small="人气爆款 不容错过">
    <template #hed> </template>
    <template #mid>
      <ul class="new-list">
        <li v-for="item in newList" :key="item.id">
          <img :src="item.picture" alt="" />
          <p class="title">{{ item.title }}</p>
          <p class="alt">{{ item.alt }}</p>
        </li>
      </ul>
    </template>
  </HomePinal>
</template>

<style>
.new-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: space-between;
  li {
    width: 303px;
    height: 403px;
    background: #f0f9f4;
    transition: all 0.5s;

    &:hover {
      transform: translate3d(0, -3px, 0);
      box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
    }
    .title {
      font-size: 24px;
      padding: 12px 30px 12px 30px;
      text-align: center;
    }
    .alt {
      font-size: 18px;
      text-align: center;
      color: darkgray;
    }
  }
}
</style>
